<template>
  <div class="right-top" id="right-top"></div>
</template>

<script>
import { currentGET } from "@/api/modules/index";
export default {
  data() {
    return {
      categray: [],
      data: []
    };
  },
  created() {},

  mounted() {
    currentGET("big4").then(res => {
      this.categray = res.data.dateList;
      this.data = res.data.numList;
      this.initCharts();
    });
  },
  beforeDestroy() {},
  methods: {
    initCharts() {
      const myChart = echarts.init(document.getElementById("right-top"));
      const option = {
        tooltip: {},
        legend: {},
        xAxis: {
          type: "category",
          data: this.categray,
          boundaryGap: false,
          axisLabel: { color: "#fff" }
        },
        yAxis: {
          type: "value",
          splitLine: {
            show: false
          },
          axisLabel: { color: "#fff" }
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross"
          }
        },
        series: [
          {
            data: this.data,
            type: "line",
            itemStyle: {
              color: "orange"
            },
            areaStyle: {},
            markPoint: {
              data: [
                { type: "max", name: "Max" },
                { type: "min", name: "Min" }
              ]
            },
            lineStyle: {
              color: "orange"
            },
            smooth: true
          }
        ]
      };
      myChart.setOption(option);
    }
  }
};
</script>
<style lang='scss' scoped>
.right-top {
  width: 500px;
  height: 300px;
}
</style>